<?php

  define('BASE_ROOT_PATH', dirname(dirname(__FILE__)));
	include_once( BASE_ROOT_PATH . "/word/db/DBMySQL.php");  

	$memberId = $_REQUEST['id'];
	if(empty($memberId)) {
	  $msg = json_encode("用户id不能为空");
		echo '{"code":"1","msg":'.$msg.'}';
		exit();
	}

	$latitude = $_REQUEST['latitude'];
	if(empty($latitude)) {
	  $msg = json_encode("纬度不能为空");
		echo '{"code":"1","msg":'.$msg.'}';
		exit();
	}
	$latitude = str_replace('\'', '\'\'', $latitude);
	
	$longitude = $_REQUEST['longitude'];
	if(empty($longitude)) {
	  $msg = json_encode("经度不能为空");
		echo '{"code":"1","msg":'.$msg.'}';
		exit();
	}
	$longitude = str_replace('\'', '\'\'', $longitude);
	
	// 查找用户
	$db = new DBMySQL();
	$rs = $db->Query("select mi.member_id,m.email from t_member m join t_member_info mi on mi.member_id = m.member_id where m.member_id = $memberId limit 1");
	if(empty($rs)) {
	  $msg = json_encode("该用户不存在");
		echo '{"code":"1","msg":'.$msg.'}';
		exit();
	}
	$val = $rs[0];
	$memberId = $val['member_id'];
	$db->Modify("update t_member_info mi set mi.latitude='$latitude',mi.longitude='$longitude' where mi.member_id = $memberId");
	echo '{"code":"0","msg":""}';
	
?>